package com.examlpe.lotterysystem.common.exception;

import com.examlpe.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException{
    //异常码
    private int code;
    //异常消息
    private String massage;

    //为了序列化
    public ControllerException() {

    }
    public ControllerException(int code, String massage) {
        this.code = code;
        this.massage = massage;
    }

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.massage = errorCode.getMsg();
    }
}
